Redux, useSelector, useDispatch


用 hooks 取代 connect

connect => hooks
取資料: mapStateToProps => useSelector
更新資料: mapDispatchToProps => useDispatch

import { Provider, useSelector, useDispatch } from 'react-redux';
import { addTodo } from './action/todolist';







你可能感興趣的文章

單元測試的藝術 - 測試你的程式

單元測試的藝術 - 測試你的程式

OAuth2.0 實作 - 使用 nodemailer 幫忙寄信

OAuth2.0 實作 - 使用 nodemailer 幫忙寄信

萬有引力與四星運動之探討

萬有引力與四星運動之探討






留言討論